(*************************************************** Ant Movie Catalog importation script www.antp.be/software/moviecatalog/ [Infos] Authors=KaraGarga Title=Excalibur Films Description=Excalibur Films Adult DVD Site=http://alldvdmovies.com Language=EN Version=0.2 - 14.10.2004 Requires=3.5.0 Comments= ExcaliburFilms| Written by KaraGarga| karagarga@gmail.com| Script Date: 14.10.2004 License=This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | GetInfo=1 [Options] ***************************************************) program Excalibur; const ImportActors = True; ImportBigCover = True; ImportSmallCover = False; ImportCustomerReview = True; ImportReview = True; ImportLenght = True; { True: Related info will be parsed False: Related info won't be parsed } var MovieName: string; MovieURL: string; function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer; var i: Integer; begin result := -1; if StartAt < 0 then StartAt := 0; for i := StartAt to List.Count-1 do if Pos(Pattern, List.GetString(i)) <> 0 then begin result := i; Break; end; end; function StringReplaceAll(S, Old, New: string): string; begin while Pos(Old, S) > 0 do S := StringReplace(S, Old, New); Result := S; end; procedure CutAfter(var Str: string; Pattern: string); begin Str := Copy(str, Pos(Pattern, Str) + Length(Pattern), Length(Str)); end; procedure CutBefore(var Str: string; Pattern: string); begin Str := Copy(Str, Pos(Pattern, Str), Length(Str)); end; function GetStringFromHTML(Page, StartTag, CutTag, EndTag: string): string; begin Result := ''; if Pos(StartTag, Page) > 0 then begin CutBefore(Page, StartTag); if Length(CutTag) > 0 then CutAfter(Page, CutTag); Result := Copy(Page, 0, Pos(EndTag, Page) - 1); HTMLDecode(Result); end; end; procedure AnalyzePage(Address: string); var Page: TStringList; begin Page := TStringList.Create; Page.Text := GetPage(Address); if pos('DVD Video Movie', Page.Text) > 0 then begin AnalyzeMoviePage(Page) end; if pos('
', #13#10+#13#10);
Value := StringReplace(Value, '
', #13#10);
Value := StringReplace(Value, 'Customer Reviews:', '');
Value := StringReplace(Value, #13#10+#13#10, #13#10);
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldComments, GetField(fieldComments)+'CUSTOMER REVIEW(s):'+Value);
end;
end;
// Length-----------------------------------------------------------------------
if ImportLenght then
LineNr := FindLine('Run Time: ', Page, 0);
if LineNr > -1 then
begin
Value := Page.GetString(LineNr);
HTMLRemoveTags(Value);
HTMLDecode(Value);
Value := StringReplace(Value, 'Run Time:', '');
Value := StringReplace(Value, ' ', '');
Value := StringReplace(Value, 'min.', '');
SetField(fieldLength, Value);
end;
// Actors-----------------------------------------------------------------------
if ImportActors then
begin
LineNr := FindLine('Starring:', Page, 0);
if LineNr > -1 then
begin
Value := Page.GetString(LineNr);
Value := StringReplace(Value, 'Starring: ', '');
Value := StringReplace(Value, 'Starring:', '');
HTMLRemoveTags(Value);
HTMLDecode(Value);
SetField(fieldActors, Value);
end;
end;
//Release Year------------------------------------------------------------------
LineNr := FindLine('Released: ', Page, 0);
if LineNr > -1 then
begin
Line := Page.GetString(LineNr);
BeginPos := pos('dana">', Line) + 6;
EndPos := pos(',', Line);
Value := copy(Line, BeginPos, EndPos - BeginPos);
SetField(fieldYear, Value);
end;
//DisplayResults;
end;
procedure AddMoviesTitles(Page: TStringList);
var
Line, Result: string;
LineNr: Integer;
MovieTitle, MovieAddress: string;
StartPos: Integer;
begin
LineNr := FindLine('', Page, 0);
if LineNr > -1 then
begin
LineNr:=FindLine('Records:', Page, 0);;
Result:= Page.GetString(LineNr+7);
StartPos := pos('', Result) + 3;
Result := Copy(Result, StartPos, Pos('', Result) - StartPos);
PickTreeAdd('Excalibur Films Search >> Number of Results: '+'('+Result+')', '');
LineNr := FindLine('', Page, 0);
LineNr := LineNr +2;
Line := Page.GetString(LineNr);
repeat
StartPos := Pos('onMouseout="window.status=''" title="DVD">', Line) + 1;
MovieTitle := Copy(Line, StartPos, Pos(' DVD ', Line) > 0;
end;
end;
begin
if CheckVersion(3,5,0) then
begin
MovieName := GetField(fieldOriginalTitle);
if MovieName = '' then
MovieName := GetField(fieldTranslatedTitle);
if Input('Excalibur Films: Adult DVD Script 0.1', 'Please enter the title of the movie:', MovieName) then
begin
AnalyzePage('http://www.alldvdmovies.com/IndexS2.htm?SearchFor=Title.x&Search=AdultDVDMovies&Case=AllDVDMovies&x=0&y=0&searchString='+UrlEncode(MovieName));
end;
end
else
ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.5.0)');
end.